<?php

/**
 * ShiftDay form base class.
 *
 * @method ShiftDay getObject() Returns the current form's model object
 *
 * @package    virtualstore
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseShiftDayForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'        => new sfWidgetFormInputHidden(),
      'shift_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Shift'), 'add_empty' => false)),
      'dayOfWeek' => new sfWidgetFormInputText(),
      'shift1'    => new sfWidgetFormInputText(),
      'shift2'    => new sfWidgetFormInputText(),
      'shift3'    => new sfWidgetFormInputText(),
      'restDay'   => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'        => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'shift_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Shift'))),
      'dayOfWeek' => new sfValidatorPass(),
      'shift1'    => new sfValidatorString(array('max_length' => 11, 'required' => false)),
      'shift2'    => new sfValidatorString(array('max_length' => 11, 'required' => false)),
      'shift3'    => new sfValidatorString(array('max_length' => 11, 'required' => false)),
      'restDay'   => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('shift_day[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ShiftDay';
  }

}
